package com.ikun.aimian.config;

import com.zhipu.oapi.ClientV4;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

@Configuration
@ConfigurationProperties(prefix = "ai")
@Data
public class AiConfig {

    private String apiKey;

    /**
     * 用于图像模型的 ApiKey
     */
    private String alApiKey;

    /**
     * 默认注入
     */
    @Bean("getClientV4")
    @Primary
    public ClientV4 getClientV4() {
        return new ClientV4.Builder(apiKey).build();
    }

//    /**
//     * 专门用于图像接口的 ClientV4
//     */
//    @Bean("getClientV4ByImage")
//    public ClientV4 imageClientV4() {
//        return new ClientV4.Builder(alApiKey).build();
//    }
}
